package com.jackrain.nea.core.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.jackrain.nea.core.api.AdsequenceSaveCmd;
import com.jackrain.nea.core.mapper.MapperShortcut;
import com.jackrain.nea.core.utility.CommandData;
import com.jackrain.nea.exception.NDSException;
import com.jackrain.nea.sys.CommandAdapter;
import com.jackrain.nea.util.ValueHolder;
import com.jackrain.nea.web.query.QuerySession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Service(protocol = "dubbo", validation = "true", version = "1.0", group = "ad")
public class AdsequenceSaveCmdImpl extends CommandAdapter implements AdsequenceSaveCmd {
    @Autowired
    private MapperShortcut mapperShortcut;

    @Override
    public ValueHolder execute(QuerySession session) throws NDSException {
        CommandData data = new CommandData(session);
        data.saveMain(mapperShortcut, "AD_SEQUENCE", "NAME");
        return data.result();
    }
}
